﻿using DoNet.Core;
using DoNet.System.IRepositories;
using DoNet.System.Models;

namespace DoNet.System.Repositories
{
    public class UserRepository : BaseRepository<User>, IUserRepository
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="serviceProvider"></param>
        public UserRepository(IServiceProvider serviceProvider) : base(serviceProvider)
        { }

        #region 同步方法
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public IEnumerable<User> GetListByIds(IEnumerable<long> ids)
        {
            return Db.Queryable<User>().Where(x => ids.Contains(x.Id)).ToList();
        }
        #endregion 同步方法

        #region 异步方法
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public async Task<IEnumerable<User>> GetListByIdsAsync(IEnumerable<long> ids)
        {
            return await Db.Queryable<User>().Where(x => ids.Contains(x.Id)).ToListAsync();
        }
        #endregion 异步方法
    }
}
